package com.starblink.imgsearch.ext

import android.graphics.RectF
import android.util.Size
import com.starblink.basic.ext.overOther

fun RectF.checkSizeAndUpdate(viewRect: RectF) {
    if (this.overOther(viewRect)) {
        this.left = viewRect.width() * 0.05f
        this.top = viewRect.height() * 0.05f
        this.right = viewRect.width() * 0.95f
        this.bottom = viewRect.height() * 0.95f
    }
}

fun Size.defaultBoxRect(): RectF {
    return RectF(
        width * 0.05f,
        height * 0.05f,
        width * 0.95f,
        height * 0.95f,
    )
}

